<template>
  <uv-popup ref="popup" round="15" :safeAreaInsetBottom="false">
    <view class="content">
      <view class="title bold textCenter">拨打客服热线</view>
      <view v-for="(tel, index) in telPhone" :key="index" class="tel flex alignCenter" @click="proxy.$auth.makePhoneCall(tel)">
        <uv-icon name="phone-fill" color="#4196A2"></uv-icon>
        <text>{{tel}}</text>
      </view>
    </view>
  </uv-popup>
</template>

<script setup lang="ts">
const { proxy } = getCurrentInstance();
import useCounterStore from "@/stores/counter";
const counter = useCounterStore();
const instance = getCurrentInstance();

let telPhone = ref([]);

let tels = computed(() => {
  let consultationTel = removeSpaces(
    counter.ycMpParams.basicInfo.consultationTel
  );
  console.log("consultationTel", consultationTel);
  let arr = consultationTel.split("/");
  return arr;
});

function removeSpaces(str) {
  return str.replace(/\s/g, "");
}

function open(info) {
  if (
    info.hasOwnProperty("consultingPhone") &&
    info.consultingPhone &&
    info.consultingPhone.length
  ) {
    telPhone.value = info.consultingPhone;
  } else {
    telPhone.value = tels.value;
  }
  instance.refs.popup.open();
}

defineExpose({ open });
</script>



<style lang="scss" scoped>
.content {
  width: 75vw;
  padding: 15px;
  .tel {
    margin-top: 10px;
    color: #4196a2;
    text {
      margin-left: 10px;
    }
  }
}
</style>



